package com.it2297.controller;

import javax.mail.Transport;
import javax.swing.JOptionPane;

import com.it2297.main.App;
import com.it2297.model.Company;
import com.it2297.util.Email;
import com.it2297.view.CompanySendEmail;


public class EmailController {
	
	private CompanySendEmail view;

	public EmailController(CompanySendEmail ccv){
		this.view = ccv;
	}
	
	public void sendEmail(){

		Email email = Email.getInstance();
		
		if(email.send(view.getFromEmail(),view.getToEmail(),view.getSubject(), view.getMessage())==true){
			JOptionPane.showMessageDialog(null, "Email sent!");
		}
		else{
			JOptionPane.showMessageDialog(null, "An error has occurred, email not sent!");
		}
		
		
		
	}
	
	

		
	

}
